<!doctype html>
<html>

<head>
  <!-- css文件 -->
  {include file="public/title" /}
</head>

<body data-type="generalComponents">
  <!-- 头部 -->
  {include file="public/header" /}
  <div class="tpl-page-container tpl-page-header-fixed">
    <!-- 左侧导航 -->
    {include file="public/leftNav" /}
    <div class="tpl-content-wrapper">
      <ol class="am-breadcrumb">
        <li><a href="#" class="am-icon-home">首页</a></li>
        <li><a href="#">系统</a></li>
        <li class="am-active">配置添加</li>
      </ol>
      <div class="tpl-portlet-components">
        <div class="tpl-block">
          <div class="am-g tpl-amazeui-form">
            <div class="am-u-sm-12 am-u-md-9">
              <form class="am-form am-form-horizontal" id="form_ajax" onsubmit="return false">
                <div class="am-form-group">
                  <label for="user-name" class="am-u-sm-3 am-form-label">中文名称</label>
                  <div class="am-u-sm-9">
                    <input type="text" name="cnname" required oninvalid="setCustomValidity('请您输入中文名称');" oninput="setCustomValidity('');"
                      id="user-name" placeholder="中文名称">
                  </div>
                </div>
                <div class="am-form-group">
                  <label for="user-mima" class="am-u-sm-3 am-form-label">英文名称</label>
                  <div class="am-u-sm-9">
                    <input type="text" name="enname" required oninvalid="setCustomValidity('请您输入英文名称');" oninput="setCustomValidity('');"
                      id="user-mima" placeholder="英文名称">
                  </div>
                </div>
                <div class="am-form-group">
                  <label for="user-mima" class="am-u-sm-3 am-form-label">配置类型</label>
                  <div class="am-u-sm-9">
                    <select name="type" data-am-selected="{searchBox: 1}">
                      <option value="1">-文本框</option>
                      <option value="2">-文本域</option>
                      <option value="3">-单选按钮</option>
                      <option value="4">-复选按钮</option>
                      <option value="5">-下拉菜单</option>
                    </select>
                  </div>
                </div>
                <div class="am-form-group">
                  <label for="user-intro" class="am-u-sm-3 am-form-label">可选值</label>
                  <div class="am-u-sm-9">
                    <textarea class="" name="values" rows="10" id="user-intro" placeholder="请输入值"></textarea>
                  </div>
                </div>
                <div class="am-form-group">
                  <div class="am-u-sm-9 am-u-sm-push-3">
                    <button type="submit" id="submitForm" class="am-btn am-btn-primary">添加</button>
                  </div>
                </div>
              </form>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- js -->
  {include file="public/foot" /}
  <script type="text/javascript">
    $('#submitForm').click(function(){
      var formData = $('#form_ajax').serialize();
      $.ajax({
        url:"{:url('conf/add')}",
        type:'POST',
        data:formData,
        success:function(data){
          if(data.statu == 200){
            layer.alert(data.info, {icon: 6});
            $("form")[0].reset();
          }else{
            layer.alert(data.info, {icon: 5});
          }
        }
      })
    })
  </script>
</body>

</html>